<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The PharFileInfo class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="phardata.setstub.html">« PharData::setStub</a></li>
      <li style="float: right;"><a href="pharfileinfo.chmod.html">PharFileInfo::chmod »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.phar.html">Phar</a></li>
    <li>The PharFileInfo class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.pharfileinfo" class="reference">
 <h1 class="title">The PharFileInfo class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 1.0.0)</p>
 

  <div class="section" id="pharfileinfo.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    The PharFileInfo class provides a high-level interface to the contents
    and attributes of a single file within a phar archive.
   </p>
  </div>
 
 
  <div class="section" id="pharfileinfo.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">PharFileInfo</strong>
     </span>

     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.splfileinfo.html" class="classname">SplFileInfo</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.chmod.html" class="methodname">chmod</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$perms</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.compress.html" class="methodname">compress</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$compression</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.decompress.html" class="methodname">decompress</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.delmetadata.html" class="methodname">delMetadata</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.getcrc32.html" class="methodname">getCRC32</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.getcompressedsize.html" class="methodname">getCompressedSize</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.getcontent.html" class="methodname">getContent</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.getmetadata.html" class="methodname">getMetadata</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$unserializeOptions</code><span class="initializer"> = []</span></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.getpharflags.html" class="methodname">getPharFlags</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.hasmetadata.html" class="methodname">hasMetadata</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.iscrcchecked.html" class="methodname">isCRCChecked</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.iscompressed.html" class="methodname">isCompressed</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$compression</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.setmetadata.html" class="methodname">setMetadata</a></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$metadata</code></span>): <span class="type"><span class="type void">void</span></span></div>

    <div class="destructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="pharfileinfo.destruct.html" class="methodname">__destruct</a></span>()</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getatime.html" class="methodname">SplFileInfo::getATime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getbasename.html" class="methodname">SplFileInfo::getBasename</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$suffix</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getctime.html" class="methodname">SplFileInfo::getCTime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getextension.html" class="methodname">SplFileInfo::getExtension</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getfileinfo.html" class="methodname">SplFileInfo::getFileInfo</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$class</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><a href="class.splfileinfo.html" class="type SplFileInfo">SplFileInfo</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getfilename.html" class="methodname">SplFileInfo::getFilename</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getgroup.html" class="methodname">SplFileInfo::getGroup</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getinode.html" class="methodname">SplFileInfo::getInode</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getlinktarget.html" class="methodname">SplFileInfo::getLinkTarget</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getmtime.html" class="methodname">SplFileInfo::getMTime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getowner.html" class="methodname">SplFileInfo::getOwner</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpath.html" class="methodname">SplFileInfo::getPath</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpathinfo.html" class="methodname">SplFileInfo::getPathInfo</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$class</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.splfileinfo.html" class="type SplFileInfo">SplFileInfo</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpathname.html" class="methodname">SplFileInfo::getPathname</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getperms.html" class="methodname">SplFileInfo::getPerms</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getrealpath.html" class="methodname">SplFileInfo::getRealPath</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getsize.html" class="methodname">SplFileInfo::getSize</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.gettype.html" class="methodname">SplFileInfo::getType</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isdir.html" class="methodname">SplFileInfo::isDir</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isexecutable.html" class="methodname">SplFileInfo::isExecutable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isfile.html" class="methodname">SplFileInfo::isFile</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.islink.html" class="methodname">SplFileInfo::isLink</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isreadable.html" class="methodname">SplFileInfo::isReadable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.iswritable.html" class="methodname">SplFileInfo::isWritable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.openfile.html" class="methodname">SplFileInfo::openFile</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code><span class="initializer"> = &quot;r&quot;</span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$useIncludePath</code><span class="initializer"> = <strong><code>false</code></strong></span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">resource</span><span class="type"></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><a href="class.splfileobject.html" class="type SplFileObject">SplFileObject</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.setfileclass.html" class="methodname">SplFileInfo::setFileClass</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code><span class="initializer"> = SplFileObject::class</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.setinfoclass.html" class="methodname">SplFileInfo::setInfoClass</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code><span class="initializer"> = SplFileInfo::class</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.tostring.html" class="methodname">SplFileInfo::__toString</a></span>(): <span class="type">string</span></div>

   }</div>

 
  </div>
 
 </div>
 
 





















































































 
<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="pharfileinfo.chmod.html">PharFileInfo::chmod</a> — Sets file-specific permission bits</li><li><a href="pharfileinfo.compress.html">PharFileInfo::compress</a> — Compresses the current Phar entry with either zlib or bzip2 compression</li><li><a href="pharfileinfo.construct.html">PharFileInfo::__construct</a> — Construct a Phar entry object</li><li><a href="pharfileinfo.decompress.html">PharFileInfo::decompress</a> — Decompresses the current Phar entry within the phar</li><li><a href="pharfileinfo.delmetadata.html">PharFileInfo::delMetadata</a> — Deletes the metadata of the entry</li><li><a href="pharfileinfo.destruct.html">PharFileInfo::__destruct</a> — Destructs a Phar entry object</li><li><a href="pharfileinfo.getcrc32.html">PharFileInfo::getCRC32</a> — Returns CRC32 code or throws an exception if CRC has not been verified</li><li><a href="pharfileinfo.getcompressedsize.html">PharFileInfo::getCompressedSize</a> — Returns the actual size of the file (with compression) inside the Phar archive</li><li><a href="pharfileinfo.getcontent.html">PharFileInfo::getContent</a> — Get the complete file contents of the entry</li><li><a href="pharfileinfo.getmetadata.html">PharFileInfo::getMetadata</a> — Returns file-specific meta-data saved with a file</li><li><a href="pharfileinfo.getpharflags.html">PharFileInfo::getPharFlags</a> — Returns the Phar file entry flags</li><li><a href="pharfileinfo.hasmetadata.html">PharFileInfo::hasMetadata</a> — Returns the metadata of the entry</li><li><a href="pharfileinfo.iscrcchecked.html">PharFileInfo::isCRCChecked</a> — Returns whether file entry has had its CRC verified</li><li><a href="pharfileinfo.iscompressed.html">PharFileInfo::isCompressed</a> — Returns whether the entry is compressed</li><li><a href="pharfileinfo.setmetadata.html">PharFileInfo::setMetadata</a> — Sets file-specific meta-data saved with a file</li></ul>
</div>
</div></div></body></html>